package com.qianfeng.smsplatform.api.dto;/***
 *                    .::::.
 *                  .::::::::.
 *                 :::::::::::  
 *             ..:::::::::::'   木马~
 *           '::::::::::::'       
 *             .::::::::::       
 *        '::::::::::::::..
 *             ..::::::::::::.
 *           ``::::::::::::::::
 *            ::::``:::::::::'        .:::.
 *           ::::'   ':::::'       .::::::::.
 *         .::::'      ::::     .:::::::'::::.
 *        .:::'       :::::  .:::::::::' ':::::.
 *       .::'        :::::.:::::::::'      ':::::.
 *      .::'         ::::::::::::::'         ``::::.
 *  ...:::           ::::::::::::'              ``::.
 * ```` ':.          ':::::::::'                  ::::..
 *                    '.:::::'                    ':'````..
 */

import com.fasterxml.jackson.annotation.JsonInclude;
import com.qianfeng.smsplatform.common.constants.ResutlDataEnum;

/**
 * @author ：zl
 * @date ：Created in 2021/7/17 19:16
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class R {

    private String code;
    private String msg;
    private Object result;

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public static R getR(ResutlDataEnum dataEnum) {
//        R r = new R();
//        r.setCode(dataEnum.getCode());
//        r.setMsg(dataEnum.getMsg());
        return getR(dataEnum, null);
    }

    public static R getR(ResutlDataEnum dataEnum,Object result) {
        R r = new R();
        r.setCode(dataEnum.getCode());
        r.setMsg(dataEnum.getMsg());
        r.setResult(result);
        return r;
    }

    public static R getR(String code,String msg,Object result) {
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        r.setResult(result);
        return r;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "R{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
